package com.ruoyi.system.service.impl;

import java.rmi.server.UID;
import java.util.List;
import java.util.UUID;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysCmsScMapper;
import com.ruoyi.system.domain.SysCmsSc;
import com.ruoyi.system.service.ISysCmsScService;
import com.ruoyi.common.core.text.Convert;

/**
 * 古诗词Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-01-31
 */
@Service
public class SysCmsScServiceImpl implements ISysCmsScService 
{
    @Autowired
    private SysCmsScMapper sysCmsScMapper;

    /**
     * 查询古诗词
     * 
     * @param id 古诗词ID
     * @return 古诗词
     */
    @Override
    public SysCmsSc selectSysCmsScById(String id)
    {
        return sysCmsScMapper.selectSysCmsScById(id);
    }

    /**
     * 查询古诗词列表
     * 
     * @param sysCmsSc 古诗词
     * @return 古诗词
     */
    @Override
    public List<SysCmsSc> selectSysCmsScList(SysCmsSc sysCmsSc)
    {
        return sysCmsScMapper.selectSysCmsScList(sysCmsSc);
    }

    /**
     * 新增古诗词
     * 
     * @param sysCmsSc 古诗词
     * @return 结果
     */
    @Override
    public int insertSysCmsSc(SysCmsSc sysCmsSc)
    {
        sysCmsSc.setId(UUID.randomUUID().toString());
        sysCmsSc.setCreateTime(DateUtils.getNowDate());
        return sysCmsScMapper.insertSysCmsSc(sysCmsSc);
    }

    /**
     * 修改古诗词
     * 
     * @param sysCmsSc 古诗词
     * @return 结果
     */
    @Override
    public int updateSysCmsSc(SysCmsSc sysCmsSc)
    {
        sysCmsSc.setUpdateTime(DateUtils.getNowDate());
        return sysCmsScMapper.updateSysCmsSc(sysCmsSc);
    }

    /**
     * 删除古诗词对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysCmsScByIds(String ids)
    {
        return sysCmsScMapper.deleteSysCmsScByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除古诗词信息
     * 
     * @param id 古诗词ID
     * @return 结果
     */
    @Override
    public int deleteSysCmsScById(String id)
    {
        return sysCmsScMapper.deleteSysCmsScById(id);
    }
}
